﻿/*
 *	lxThread.h
 *
 *  Created 2017年4月1日
 *  Author: wangwei
 */

#ifndef XX_COMMON_THREAD_HH
#define XX_COMMON_THREAD_HH

#include "xmutex.h"

class lxThread
{
public:
	lxThread(void);

	virtual void Run(void);

	virtual ~lxThread(void);
public:
	virtual void End();

	virtual void Join();

	virtual bool IsRun();

	virtual int32 Start();

#ifndef WIN32
	virtual int	Start(void* (*ThreadFun)(void*), void* lpParam);
#else
	virtual int	Start(_beginthreadex_proc_type ThreadFun, void* lpParam);
#endif // WIN32
protected:
	bool	m_bThreadEnd;
#ifndef WIN32
	pthread_t	 m_hThread;
	static void* ThreadProc(void* pParam);
#else
	HANDLE		 m_hThread;
	static unsigned WINAPI ThreadProc(void* pParam);
#endif // WIN32
};

#endif
